<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="ko">
<head>
	<%@ include file="/include/header.jsp" %>
	<%@ include file="/include/commonRes.jsp" %>
	<link rel="stylesheet" href="<%=cp %>/css/board.css">
	<script type="text/javascript">
		$(function(){
			$("#artice_area li a").click(function(){
				var deptid=$(this).attr("id");
				
				var clickval="";
				if(deptid=="dept_all"){
					clickval="";
				}else if(deptid=="dept_service1"){
					clickval="1";
				}else if(deptid=="dept_service2"){
					clickval="2";
				}else if(deptid=="dept_healthCare"){
					clickval="3";
				}else if(deptid=="dept_mng"){
					clickval="4";
				}
				
				$("#tabclickForm input[name='dept']").val(clickval);
				$("#tabclickForm").submit();
				return false;
			});
			$("#emp_regist").click(function(){
				$("#editForm").submit();
				return false;
			});
			
		});
		function search(){
			$("#listFrm input[name='page']").val(1);
			return true;
		}
		function view(mb_id){
			$("#viewForm input[name='mb_id']").val(mb_id);
			$("#viewForm").submit();
		}
	</script>
</head>
<body>
<div id="hd_login_msg">${sessionScope.ss_mb.mb_name} 로그인 중 <a href="<%=cp %>/logout.do">로그아웃</a></div>
<%@include file="/include/mainMenuHeader.jsp" %>
<div id="wrapper">
	<form method="post" id="viewForm" action="<%=cp%>/org/org_view.do">
		<input type="hidden"   name="mb_id" value="" />
	</form>
	<form method="get" id="editForm" action="<%=cp%>/org/org_edit.do">
		<input type="hidden"   name="mb_id" value="" />
	</form>
	
	<h2>조직도</h2>
	<form method="post" id="tabclickForm">
		<input type="hidden"   name="dept" value="" />
	</form>
	<!-- 검색조건 -->
	<fieldset id="bo_sch">
	    <legend>게시물 검색</legend>
		<form id="regFrm" name="regFrm" method="get" action="<%=cp%>/org/org_edit.do">

	    </form>
		<form id="pageFrm" name="pageFrm" method="post">
			<input type="hidden"   name="dept" value="${dept }" />
		    <input type="hidden" name="page" value="${page }" >
		     <input type="hidden" name="mb_level" value="${mb_level }" >
		    <input type="hidden" name="typeSelect" value="${typeSelect }">
		    <input  type="hidden" name="input"   value="${input }">
	    </form>
	    
	    <form id="pageFrm" name="pageFrm" method="post">
			<input type="hidden"   name="dept" value="${dept }" />
		    <input type="hidden" name="page" value="${page }" >
		     <input type="hidden" name="mb_level" value="${mb_level }" >
		    <input type="hidden" name="typeSelect" value="${typeSelect }">
		    <input  type="hidden" name="input"   value="${input }">
	    </form>
	    
	  <div style="background-color:#e6e6e6;height:26px;width:100%;padding-top:3px;">
	    <form id="listFrm" name="listFrm" method="post" onsubmit="search()">
		    <input type="hidden"   name="dept" value="${dept }" />
		    <input type="hidden" name="page" value="${page }">
		    <label for="sfl" class="sound_only">검색대상</label>
		    
		    
		    <select id="typeSelect" name="typeSelect">
		        <option value="name" <c:if test="${typeSelect=='name' }">selected</c:if>>이름</option>
		        <option value="phone" <c:if test="${typeSelect=='phone' }">selected</c:if>>연락처</option>
		    </select>
		    <c:if test="${sessionScope.ss_mb.mb_auth_code==4 || sessionScope.ss_mb.mb_auth_code==5 || sessionScope.ss_mb.mb_auth_code==7 || sessionScope.ss_mb.mb_auth_code==8}">
			    <select id="mb_level" name="mb_level">
			        <option value="1" <c:if test="${mb_level!='0' }">selected</c:if>>재직</option>
			        <option value="0" <c:if test="${mb_level=='0' }">selected</c:if>>퇴사</option>
			    </select>
		    </c:if>
		    <input name="input"  placeholder="검색어(필수)" class="frm_input size100"  id="input"  value="${input }">
		    <input type="submit" value="검색" class="btn_submit" />	    	
	    </form>
	  </div>  
	</fieldset>
	<div id="bo_list">
		<nav id="bo_cate">
	    	<h2>공지 사항 카테고리</h2>
	    	<ul id="artice_area">
           		<li>
					<a href="#" id="dept_all" <c:if test="${empty dept }">class="blackBold"</c:if>>전체</a>
				</li>
				<li>
					<a href="#" id="dept_service1" <c:if test="${dept=='1' }">class="blackBold"</c:if>>서비스1과</a>
				</li>
				<li>
					<a href="#" id="dept_service2" <c:if test="${dept=='2' }">class="blackBold"</c:if>>서비스2과</a>
				</li>
				<li>
					<a href="#" id="dept_mng" <c:if test="${dept=='4' }">class="blackBold"</c:if>>부장/차장</a>
				</li> 
				<li>
					<a href="#" id="dept_healthCare" <c:if test="${dept=='3' }">class="blackBold"</c:if>>원장</a>
				</li> 
			</ul>
	    </nav>
	    
	    <div class="bo_fx">
	    	<div id="bo_list_total">
	            <span>Total ${totalcnt }건</span>${page }페이지
	        </div>
	        <c:if test="${sessionScope.ss_mb.mb_auth_code==7 || sessionScope.ss_mb.mb_auth_code==8 }">
				<div class="right_align_area">
		            <input type="button" value="직원등록" class="btn_reg" id="emp_regist" />
		        </div>
	        </c:if>
	        <!-- list -->
		    <div class="tbl_head01 tbl_wrap">
		        <div class="org_li_table">
					<ul class="subject th">
						<li class="col num_area">No</li>
						<li class="name_area">이름</li>
						<li class="dept_area">부서</li>
						<li class="position_area">직책</li>
						<li class="hp_area">연락처</li>
					</ul>
					<c:if test="${empty list }">
						<ul class="content">
							<li class="emptyList">목록이 없습니다.</li>
						</ul>
					</c:if>
					<c:if test="${not empty list }">
						<c:forEach var="item" items="${list}">
							<ul class="content">
								<li class="col font11 num_area">${item.row }<c:if test="${empty item.row}">-</c:if></li>
								<li class="font11 name_area">
									<a href="#" onclick="view('${item.mb_id}')"> 
										${item.mb_name}<c:if test="${empty item.mb_name}">-</c:if>
									</a>
								</li>
								<li class="font11 dept_area">${item.mb_dept_name}<c:if test="${empty item.mb_dept_name}">-</c:if></li>
								<li class="font11 position_area">${item.mb_auth_name}<c:if test="${empty item.mb_auth_name }">-</c:if></li>
								<li class="hp_area font10 hp_area">${item.mb_hp}<c:if test="${empty item.mb_hp}">-</c:if></li>
								<%--
								<c:if test="${item.mb_level!=0 }">
									<li class="font11 serverd_area">[재직중]</li>
								</c:if>
								<c:if test="${item.mb_level==0 }">
									<li class="font11 serverd_area">[퇴사]</li>
								</c:if>
 								--%>
 							</ul>
						</c:forEach>
					</c:if>
				</div>
		    </div>
	    
	    
	    </div>
	</div>
	<%@ include file="/include/pageInc.jsp"%>
</div>
</body>
</html>